import request from '@/utils/request'

// 获取数据
export const getPersonnelList = function(params) {
  return request({
    url: '/api/user-service/user/search',
    method: 'GET',
    params
  })
}

// 获取角色
export const getRoleList = function() {
  return request({
    url: '/api/user-service/role',
    method: 'GET'
  })
}

// 获取区域
export const getRegionList = function(params) {
  return request({
    url: '/api/vm-service/region/search',
    method: 'GET',
    params
  })
}

// 新增
export const addPersonnelList = function(data) {
  return request({
    url: '/api/user-service/user',
    method: 'POST',
    data
  })
}

// 详情
export const detailPersonnelList = function(id) {
  return request({
    url: '/api/user-service/user/' + id,
    method: 'GET'
  })
}

// 修改
export const updatePersonnelList = function(data) {
  return request({
    url: '/api/user-service/user/' + data.id,
    method: 'PUT',
    data
  })
}

// 删除
export const removePersonnelList = function(id) {
  return request({
    url: '/api/user-service/user/' + id,
    method: 'DELETE'
  })
}

// 获取人员工作量列表
export const getWorkList = function(params) {
  return request({
    url: '/api/user-service/user/searchUserWork',
    method: 'GET',
    params
  })
}

// 获取用户工作量(工单统计)
export const getTaskList = function(params) {
  return request({
    url: '/api/task-service/task/userWork',
    method: 'GET',
    params
  })
}

// 获取当时工单汇总信息(人员统计头部信息)
export const getHeaderList = function(params) {
  return request({
    url: `/api/task-service/task/taskReportInfo/${params.start}/${params.end}`,
    method: 'GET',
    params
  })
}

// 工单状态统计
export const getCollectList = function(params) {
  return request({
    url: `/api/task-service/task/collectReport/${params.start}/${params.end}`,
    method: 'GET',
    params
  })
}
